﻿<Window xmlns:my="clr-namespace:Brjnk.GpxExplorer.UI"  x:Class="Brjnk.GpxExplorer.UI.SearchConfigurationWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        FocusManager.FocusedElement="{Binding ElementName=okButton}"
        WindowStartupLocation="CenterOwner"
        Title="{l:Loc titleSearchConfiguration}"
        SizeToContent="WidthAndHeight" MinWidth="300" ResizeMode="NoResize">
    <StackPanel>

        <TextBlock Style="{StaticResource HeaderStyle}" Text="{l:Loc searchConfigurationWaypoints}" />
        <my:SearchPositionArgsEditor Grid.Row="1" x:Name="editor1" />

        <TextBlock Style="{StaticResource HeaderStyle}" Text="{l:Loc searchConfigurationPhotos}" />
        <my:SearchPositionArgsEditor x:Name="editor2" />

        <TextBlock Style="{StaticResource HeaderStyle}" Text="{l:Loc searchConfigurationPushpin}" />
        <my:SearchPositionArgsEditor x:Name="editor3" />

        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
            <Button IsCancel="True"  Content="{l:Loc cancel}" Click="Button_Click" />
            <Button IsDefault="True"  Content="{l:Loc ok}" Click="Button_Click_1" Name="okButton">
                <Button.Style>
                    <Style TargetType="Button" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=editor1, Path=LimitValidationFailed}"  Value="true">
                                <Setter Property="IsEnabled" Value="false" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding ElementName=editor2, Path=LimitValidationFailed}"  Value="true">
                                <Setter Property="IsEnabled" Value="false" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
        </StackPanel>
    </StackPanel>
</Window>